<!DOCTYPE html>
<html>
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title></title>
    <script src="https://cdn.jsdelivr.net/npm/vue/dist/vue.js"></script>
</head>
<body>
    <template id='sonTemp'>
        <div id="header" class="my" style="background-color:red">
        子组件
        <input :type="$attrs.type">
    </div>
        
    </template>
    <script>
        const son={
            template:'#sonTemp',
            created(){
                console.log(this.$attrs.id);
            }
        }
    </script>
    <div id='app'>
        <son id='son' type='password' class="on" style="color:green">

        </son>
    </div>
    <script>
    const vm = new Vue({
        el: '#app',
        data: {
        },
        components:{
                son
            }
    })
    </script>
</body>
</html>